//
//  DesrictionCollectionViewCell.m
//  GOGOTravel
//
//  Created by dllo on 16/1/30.
//  Copyright © 2016年 果果. All rights reserved.
//

#import "DesrictionCollectionViewCell.h"
#import "Bigmodel.h"
@implementation DesrictionCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}
/** 重写属性model set方法*/
- (void)setModel:(Bigmodel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [_imageView sd_setImageWithURL:[NSURL URLWithString:_model.cover] placeholderImage:[UIImage imageNamed:PLACE_HLODER]];
    
    
    _titleLable.text = _model.name;
    
}
- (void)createSubViews {
    self.imageView = [[UIImageView alloc] init];
    _imageView.layer.cornerRadius = 7;
    _imageView.layer.masksToBounds = YES;
    _imageView.layer.borderColor = [UIColor cyanColor].CGColor;
    _imageView.layer.borderWidth = 2;
    [self.contentView addSubview:_imageView];
    [_imageView release];
    
    self.view1 = [[UIView alloc] init];
    _view1.layer.cornerRadius = 7;
    _view1.layer.masksToBounds = YES;
    [self.contentView addSubview:_view1];
    [_view1 release];
    
    self.titleLable = [[UILabel alloc] init];
   
    [self.contentView addSubview:_titleLable];
    [_titleLable release];
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    self.imageView.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height);
    
    
    _view1.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height);
    _view1.backgroundColor = [UIColor blackColor];
    _view1.alpha = 0.2;
    
    
    self.titleLable.frame = CGRectMake(10, layoutAttributes.frame.size.height - 50, 200, 40);
    _titleLable.backgroundColor = [UIColor clearColor];
    _titleLable.font = [UIFont boldSystemFontOfSize:17];
    _titleLable.textColor = [UIColor whiteColor];
}

- (void)dealloc{
    [_model release];
    [_imageView release];
    [_titleLable release];
    [_view1 release];
    [super dealloc];
}

@end
